<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="./lib/vue.js"></script>
</head>
<body>
    <div id="app">
        <input type="button" value="浪起来" @click="start">
        <input type="button" value="低调" @click="stop">
        <h4>{{msg}}</h4>
       
    </div>
    <script>
        var vm = new Vue({
            el : "#app",
            data : {
                msg:"猥琐发育，别浪！",
                // 计时器
                IntervalId:null
            },
            methods:{
                // es6 方法可以直接函数名(){}  start(){}  
                start(){
                    // 只允许开启一个定时器
                    if (this.intervalId == null) {
                        // es6中 () => {} 可以函数内部的this = 函数外部的this
                        this.intervalId = setInterval( () => {
                        var start = this.msg.substring(0,1);
                        var end = this.msg.substring(1);
                        this.msg = end + start;
                        },300);   
                    }   
                }, 
                stop(){
                    clearInterval(this.intervalId);
                    this.intervalId = null;
                }
            }
        });

        var vm = new Vue({
            el:选择器,
            data:{
                variable:key,
                list:[],
                lists:[
                    {},
                    {}
                ],
                object:{}
            },
            methods:{
                add(){},
            },
            
            // 过滤器
            filters:{
                过滤器名字: function(dataStr){  
                }
            },
            // 指令
            directives:{
                "指令名字"：{
                    钩子函数
                }
            },
            // 组件
            components:{
                组件名:"模块",
            },

            // 钩子函数
            beforeCreate(){},
            created(){},
            beforeMount(){},
            mounted(){},
            beforeUpdate(){},
            updated(){},
            beforeDestroy(){},
            destroyed(){},

        })
    </script>
</body>
</html>